#include "bomb_buff.h"

CBombBuff::CBombBuff()
    : CBuff(ENT_DEBUFF_BOMB,
          "debuff_bomb",
          BUFF_TYPE_BUFF)
{
}

bool CBombBuff::applyBuff(CPlayer *pPlayer)
{
    /**
     * Applies this buff to a specific player. This buff increases the clip 
     * count on the player's clip by 1.
     * 
     * @param CPlayer *pPlayer The player to apply the buff to.
     * @return bool Whether the buff was applied
     */
    if (pPlayer->getActiveWeapon())
    {
        if (pPlayer->getActiveWeapon()->getID() == ENT_WEAPON_BOMB)
        {
            pPlayer->getActiveWeapon()->setClipCount(
                pPlayer->getActiveWeapon()->getClipCount() + 1);
            return true;
        }
    }
    return false;
}

bool CBombBuff::removeBuff(CPlayer *pPlayer)
{
    /**
     * Removes this buff from a specific player. This buff decreases the clip 
     * count on the player's clip by 1.
     * 
     * @param CPlayer *pPlayer The player to remove the buff from.
     * @return bool Whether the buff was removed
     */
    if (pPlayer->getActiveWeapon())
    {
        if (pPlayer->getActiveWeapon()->getID() == ENT_WEAPON_BOMB)
        {
            if (pPlayer->getActiveWeapon()->getClipCount() > 0)
            {
                pPlayer->getActiveWeapon()->setClipCount(
                    pPlayer->getActiveWeapon()->getClipCount() - 1);
                return true;
            }
        }
    }
    return false;
}